import bus from '@/bus'
import { renderButton } from '@/util';
let data = {
	status: 'pass',
	totalItem: 1,
	pageSize: window.$pageSize,
	currentPage: 1,
	columns: [{
		title: '用户名',
		key: 'userName',
		minWidth: 150
	}, {
		title: '角色',
		align: 'left',
		key: 'department_name',
    minWidth: 200
	}, {
		title: '是否是管理员',
		align: 'left',
		key: 'is_admin',
    minWidth: 200,
    render: (h, p) => {
      return h('div', p.row.is_admin ? "是" : "否")
    }
	}, {
		title: '创建时间',
		align: 'left',
		key: 'add_time',
    minWidth: 200
  }, {
		title: '头像',
		align: 'left',
		key: 'avatar',
    minWidth: 200,
    render: (h, p) => {
      return h('img', {
        style:{
          width: '40px',
          height: '40px'
        },
        attrs: {
          src: p.row.avatar
        }
      })
    }
  }, {
		title: '操作',
		align: 'right',
		minWidth: 150,
		render: (h, params) => {
			return (
				<div>
					{ renderButton(h, { text: '编辑', type: 'primary',  disabled: params.row.isMaster,},
						()=>{ bus.$emit("onEdit", params.row.id)})}
					{ renderButton(h, { text: '删除',type: 'warning', disabled: params.row.isSystem   || params.row.isLocked ? true : false,},
						()=>{ bus.$emit("onDelete", params.row.id, params.row.isSystem, params.row.userName)})}
				</div>
			)
		}
	}],
	data: []
}
export default data